﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;

/// <summary>
/// Summary description for Class1
/// </summary>
public class StringTokenizer : IEnumerable, IEnumerator
{
    string[] tokensizedStrs;
    int index = -1;
    public StringTokenizer(string target, char[] tokens)
    {
        tokensizedStrs = target.Split(tokens);
    }
    public IEnumerator GetEnumerator()
    {
        return this;
    }

    object IEnumerator.Current
    {
        get
        {
            return tokensizedStrs[index];
        }
    }

    bool IEnumerator.MoveNext()
    {
        if (++index >= tokensizedStrs.Length)
            return false;
        else
            return true;
    }

    void IEnumerator.Reset()
    {
        index = -1;
    }
}